class Canvas2d {
    private _width: number = 1080;
    private _height: number = 960;
    private _canvas: HTMLCanvasElement;
    protected _pixelRatio: number;
    protected _ctx: CanvasRenderingContext2D;

    constructor() {
        this._pixelRatio = devicePixelRatio;
        this._canvas = document.createElement('canvas');
        this._setupCanvasWidth(this._width);
        this._setupCanvasHeight(this._height);

        this._ctx = <CanvasRenderingContext2D>this._canvas.getContext('2d');
    }

    private _setupCanvasWidth(width: number) {
        this._canvas.width = width * this._pixelRatio;
        this._canvas.style.width = `${width}px`;
    }

    private _setupCanvasHeight(height: number) {
        this._canvas.height = height * this._pixelRatio;
        this._canvas.style.height = `${height}px`;
    }

    getWidth() {
        return this._width;
    }

    getHeight() {
        return this._height;
    }
}

export default Canvas2d;
